<template>
    <div>
        <ul class="head-tab">
            <li :class="{'tab-acitve': tabIndex === 1}" @click="changeTab(1)">
                待送货
            </li>
            <li :class="{'tab-acitve': tabIndex === 2}" @click="changeTab(2)">
                送货完成
            </li>
        </ul>
        <scroll-view scroll-y :style="{height: scrollHeight}">
            <ul class="list">
                <li class="list-item" v-for="(info, key) in list" :key="info.name">
                    <div class="item-title">
                        <div class="item-address">地址：<span>{{info.address}}</span></div>
                        <div class="item-status">{{info.status}}</div>
                    </div>
                    <div class="item__info">
                        <image class="item-img" :src="info.url"/>
                        <div class="item__info-order">
                            <div class="item-name van-multi-ellipsis--l2">{{info.name}}</div>
                            <div class="item-desc">蓝色 商品属性</div>
                            <div class="item-price">
                                <span>¥{{info.price}}</span>
                                <div class="item-number">x{{info.number}}</div>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </scroll-view>
    </div>
</template>
<script>
export default {
    data () {
        return {
            scrollHeight: '300px',
            tabIndex: 1,
            orderStatusOptions: [
                {
                    name: '全部',
                    value: 0
                },
                {
                    name: '进行中',
                    value: 1
                },
                {
                    name: '已完成',
                    value: 2
                }
            ],
            list: [
                {
                    url: 'http://c.hiphotos.baidu.com/baike/c0%3Dbaike150%2C5%2C5%2C150%2C50/sign=bbb98e7431dbb6fd3156ed74684dc07d/42a98226cffc1e1760e1b6be4290f603728de9e7.jpg',
                    name: '师傅的分手分多少2',
                    price: 100,
                    status: '已完成',
                    createTime: 1566224575753,
                    address: '上的分手发生地方读书史蒂夫',
                    number: 1
                },
                {
                    url: 'http://c.hiphotos.baidu.com/baike/c0%3Dbaike150%2C5%2C5%2C150%2C50/sign=bbb98e7431dbb6fd3156ed74684dc07d/42a98226cffc1e1760e1b6be4290f603728de9e7.jpg',
                    name: '师傅的分手分多少3',
                    price: 200,
                    status: '进行中',
                    createTime: 1566224575753,
                    address: '上的分手发生地方读书史蒂夫',
                    number: 2
                },
                {
                    url: 'http://c.hiphotos.baidu.com/baike/c0%3Dbaike150%2C5%2C5%2C150%2C50/sign=bbb98e7431dbb6fd3156ed74684dc07d/42a98226cffc1e1760e1b6be4290f603728de9e7.jpg',
                    name: '师傅的分手分多少4',
                    price: 300,
                    status: '进行中',
                    createTime: 1566224575753,
                    address: '上的分手发生地方读书史蒂夫',
                    number: 3
                },
                {
                    url: 'http://c.hiphotos.baidu.com/baike/c0%3Dbaike150%2C5%2C5%2C150%2C50/sign=bbb98e7431dbb6fd3156ed74684dc07d/42a98226cffc1e1760e1b6be4290f603728de9e7.jpg',
                    name: '师傅的分手分多少4',
                    price: 300,
                    status: '进行中',
                    createTime: 1566224575753,
                    address: '上的分手发生地方读书史蒂夫',
                    number: 1
                }
            ]
        };
    },
    created () {
        wx.getSystemInfo({
            success: (res) => {
                this.scrollHeight = res.windowHeight - 42 + 'px';
                // this.setData({
                //     scrollHeight: res.windowHeight - 40 + 'px'
                // });
            }
        });
    },
    methods: {
        changeTab (index) {
            this.tabIndex = index;
        }
    }
};
</script>
<style lang="scss" scoped>
    .head-tab {
        margin: 0px 15px 10px;
        height: 30px;
        display: flex;
        border: 1px solid $theme-color;
        color: $theme-color;
        font-size: 14px;
        border-radius: 2px;
        li {
            flex: 1;
            text-align: center;
            height: 30px;
            line-height: 30px;
        }
        .tab-acitve {
            background: $theme-color;
            color: #fff;
        }
    }
    .list {
        background: $grey-bg;
        padding: 15px 0px;
    }
    .list-item {
        background: #fff;
        border-radius: 4px;
        padding: 16px;
        margin-bottom: 14px;
    }
    .item__info {
        display: flex;
        align-items: center;
    }
    .item-img {
        width: 100px;
        height: 100px;
        border-radius: 4px;
    }
    .item-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 10px;
    }
    .item__info-order {
        flex: 1;
        height: 100px;
        margin-left: 10px;
        display: flex;
        flex-direction: column;
    }
    .item-name {
        line-height: 24px;
        font-size: 14px;
    }
    .item-desc {
        color: $grey-color;
        font-size: 12px;
        padding: 10px 0px;
    }
    .item-price {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 15px;
        color: $yellow-color;
        line-height: 22px;
    }
    .item-number {
        color: $color-text;
    }
    .item-status {
        width: 52px;
        height: 20px;
        line-height: 20px;
        text-align: center;
        border: 1px solid $theme-color;
        color: $theme-color;
        border-radius: 10px;
        font-size: 12px;
    }
</style>
